- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=download-ibiblio"

- name: Download servers
  hosts: download
  user: root
  gather_facts: False

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  tasks:

  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"


- name: post-initial-steps
  hosts: download
  user: root
  gather_facts: True

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - "/srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml"

  roles:
  - base
  - rkhunter
  - nagios_client
  - hosts
  - fas_client
  - collectd/base
  - apache
  - download
  - { role: mod_limitipconn, when: ansible_distribution_major_version|int != '7'}
  - rsyncd
  - { role: nfs/client, when: datacenter == "phx2", mnt_dir: '/srv/pub',  nfs_src_dir: 'fedora_ftp/fedora.redhat.com/pub' }
  - { role: nfs/client, when: datacenter == "phx2", mnt_dir: '/mnt/koji/compose',  nfs_src_dir: 'fedora_koji/koji/compose' }
  - { role: nfs/client, when: datacenter == "rdu", mnt_dir: '/srv/pub',  nfs_src_dir: 'fedora_ftp/fedora.redhat.com/pub' }
  - sudo
  - { role: openvpn/client, when: datacenter != "phx2" }

  tasks:
  - import_tasks: "{{ tasks_path }}/yumrepos.yml"
  - import_tasks: "{{ tasks_path }}/2fa_client.yml"
  - import_tasks: "{{ tasks_path }}/motd.yml"

  - name: put in script for syncing on download-ib01
    copy: src="{{ files }}/download/sync-up-downloads.sh.ib01" dest=/usr/local/bin/sync-up-downloads owner=root group=root mode=755
    when: inventory_hostname == 'download-ib01.fedoraproject.org'
  - name: put in script for syncing on download-ib01
    copy: src="{{ files }}/download/sync-up-other.sh.ib01" dest=/usr/local/bin/sync-up-other owner=root group=root mode=755
    when: inventory_hostname == 'download-ib01.fedoraproject.org'
  - name: put in cron job for syncing
    copy: src="{{ files }}/download/download-sync.cron.ib01"  dest=/etc/cron.d/download-sync owner=root group=root mode=644
    when: inventory_hostname == 'download-ib01.fedoraproject.org'
  - name: put in last sync scrypt for download-ib01
    copy: src="{{ files}}/download/last-sync" dest=/usr/local/bin/last-sync mode=0755
    when: inventory_hostname == 'download-ib01.fedoraproject.org'
  - name: install bc so last-sync works.
    package: name=bc state=present
    when: inventory_hostname == 'download-ib01.fedoraproject.org'




  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

